package cn.kgc.searchservice.controller;

import cn.kgc.searchservice.service.SearchService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
public class SearchController {

    @Autowired
    private SearchService searchService;

    @GetMapping("/articles")
    public List<Map<String, Object>> getNews(@RequestParam("keyword") String keyword) {
        return searchService.getNews(keyword);
    }
}
